package Exception;

import java.util.Scanner;

/**
 * @author 王艺锡
 * @version 1.0
 */
public class Exercise {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int ret = 0;
        String str = "";
        while (true) {
            System.out.print("请输入一个整数:");
            str = input.next();
            try {
                ret = Integer.parseInt(str);
                break;
            } catch (Exception e) {
                System.out.println(e.getMessage());
            }
            System.out.println("输入错误，请重新输入!");
        }
        System.out.println("输入的整数为:" + ret);
    }
}
